//
// Created by Martin on 2021/9/29.
//

#include "Waiter.h"
#include "Command.h"
#include "BakeMuttonCommand.h"
#include "BakeChickenCommand.h"

/**
 * 客户端测试命令模式应用示例
 */
int main()
{
    Waiter *waiter; // 创建服务员对象
    waiter = new Waiter();

    // 订单添加 烤鸡翅
    Command * bakeChickenCommand = new BakeChickenCommand();
    waiter->setOrder(bakeChickenCommand);

    // 订单添加 烤鸡翅
    Command * bakeChickenCommand2 = new BakeChickenCommand();
    waiter->setOrder(bakeChickenCommand2);

    // 订单添加 烤羊肉
    Command * bakeMuttonCommand1 = new BakeMuttonCommand();
    waiter->setOrder(bakeMuttonCommand1);

    // 订单添加 烤羊肉
    Command * bakeMuttonCommand2 = new BakeMuttonCommand();
    waiter->setOrder(bakeMuttonCommand2);

    // 订单取消 烤鸡翅
    waiter->cancelOrder(bakeChickenCommand2);

    // 通知厨房下订单
    waiter->notify();

    // 释放资源
    delete waiter;
    delete bakeChickenCommand;
    delete bakeChickenCommand2;
    delete bakeMuttonCommand1;
    delete bakeMuttonCommand2;

    return 0;
}
